#ifndef __MESSAGECOMM_H__
#define __MESSAGECOMM_H__ 

#include "type.h"

//消息类型
struct Type_Cmd
{
  Type_Cmd(uint8 param = 0, uint8 cmd = 0)
    :param_(param)
    ,cmd_(cmd)
  {}
  union
  {
    struct 
    {
      uint8 param_;//大类型
      uint8 cmd_;//小类型
    };
    uint16 paramcmd_;
  };
};

#define NAMELEN 6
#define ACCOUNTLEN 6  
#define PASSWDLEN 6
namespace Cmd
{
  //大类型
  const uint8 LOGIN_CMD = 1;


  //登陆协议
  const uint8 REGISTER_USERCMD = 1;
  struct RegisterUserCmd : public Type_Cmd 
  {
    RegisterUserCmd()
    :Type_Cmd(LOGIN_CMD, REGISTER_USERCMD)
    {
      username_[0] = 0;
      acccount_[0] = 0;
      passwd_[0] = 0;
    }
    char username_[NAMELEN];
    char acccount_[ACCOUNTLEN];
    char passwd_[PASSWDLEN];
  };

  const uint8 LOGIN_USERCMD = 2;
  struct LoginUserCmd : public Type_Cmd 
  {
    LoginUserCmd()
    :Type_Cmd(LOGIN_CMD, LOGIN_USERCMD)
    {
      acccount_[0] = 0;
      passwd_[0] = 0;
    }
    char acccount_[ACCOUNTLEN];
    char passwd_[PASSWDLEN];
  };

  const uint8 LOGIN_RESP_USERCMD = 3;
  struct LoginRespUserCmd : Type_Cmd 
  {
    LoginRespUserCmd()
      :Type_Cmd(LOGIN_CMD, LOGIN_RESP_USERCMD)
    {
      res_ = 0;
      username_[0] = 0;
      charid = 0;
    }
    uint8 res_;
    char username_[NAMELEN];
    char* charid;

  };
}


#endif
